const setHttp = require('./request.js').setHttp;
const comment = {


  /***
* @desc 获取快速评论
*/
  getFastComments(data) {
    return setHttp(
      `/api/comment/default/${data.type}`,
      data,
      'get'
    )
  },

  /***
  * @desc 创建评论
  * @param [bubbleId]
  * @param [comment]
  */
  createComment(data){
    return setHttp(
      `/api/bubble/comment/${data.bubbleId}`,
      data,
      'post'
    )
  },

  /***
  * @desc 删除评论
  * @param [commentId]
  */
  deleteComment(data){
    return setHttp(
      `/api/bubble/comment/${data.commentId}`,
      data,
      'delete',
    )
  },

  /***
* @desc 评论点赞
* @param [commentId]
*/
  praiseComment(data) {
    return setHttp(
      `/api/bubble/comment/praise/${commentId}`,
      data,
      'post',
    )
  },



  /***
  * @desc 更新评论
  * @param [packageId,commentId]
  * @param [comment]
  */
  updateComment(data){
    return setHttp(
      `api/comment/${data.commentId}/package/${data.packageId}`,
      data,
      'post'
    )
  },

  /***
  * @desc 获取包所有评论
  * @param [bubbleId]
  * @param [page={pageindex,pagesize}]
  */
  getComments(data) {
    return setHttp(
      `api/bubble/comment/${data.bubbleId}/Pager`,
      {
        pageIndex: data.pageIndex,
        pageSize: data.pageSize
      },
      'get'
    )
  },

  /***
  * @desc 获取包热门评论
  * @param [packageId]
  * @param [range]
  */
  getHotComment(data){
    return setHttp(
      `api/comment/${data.packageId}/HotList`,
      {
        range:data.range
      },
      'get'
    )
  },
  
  /***
  * @desc 获取评论内容
  * @param [commentId]
  */

  getCommmentContent(data){
    return setHttp(
      `api/comment/${data.commentId}/list`,
      {},
      'get'
    )
  },
  
  /***
  * @desc 获取用户评论
  * @param [isRead,pageIndex,pageSize]
  */
  getUserComment(data){
    return setHttp(
      `api/comment/User/Pager`,
      data,
      'get'
    )
  }

}

module.exports =  comment